<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <!--[if IE]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <![endif]-->
    <title>首页</title>
    <link href="https://cdn.bootcss.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet" />
    <!-- CUSTOM STYLE CSS -->
    <#include "include.ftl">
</head>
<body>
<#include "header.ftl">

<section>
    <div class="container">
        <div class="row">
            <div class="col-md-9">
                <div class="blogList" style="background-color: #FFFFFF;">
                    <#list articles as l>
                        <div class="blog-main">
                            <div class="heading-blog">
                                <a href="/blog/detail/${l.id}">${l.title}</a>
                            </div>
                            <div class="blog-info">
                                <span>作者：${l.userName}</span>
                                &nbsp;
                                <span>
                                        阅读：${l.viewcount}
                                </span>
                                &nbsp;
                                <span >${l.createtime}</span>
                            </div>
                        </div>
                    </#list>
                </div>
                <a href="javascript:;" class="button button-block button-rounded button-large" id="more_art">更多</a>
                <br>
                <!--PAGING  END -->
            </div>
            <#include "right.ftl">
    </div>
</section>
<hr />

<#include "footer.ftl">

</body>
<script>
    var tips = '没有啦~';
    var pageNo = 2;
    $('#more_art').click(function () {

        if(tips == $('#more_art').text()) {
            return;
        }
        $.ajax({
            url:"/blog/jsonList",
            type:"post",
            data:{pageNo:pageNo},
            success:function(data){
                if(data == null || data == '') {
                    $('#more_art').text(tips);
                }
                else {
                    var l = '';
                    $.each(data,function(index,item){
                        l += '<div class="blog-main"><div class="heading-blog">\n' +
                                '                        <a href="/blog/detail/'+item.id+'">'+item.title+'</a>\n' +
                                '                    </div>\n' +
                                '                    <div class="blog-info">\n' +
                                '                        <span>作者：'+item.userName+'</span>\n' +
                                '                        &nbsp;\n' +
                                '                        <span>\n' +
                                '                                阅读：'+item.viewcount+'\n' +
                                '                        </span>\n' +
                                '                        &nbsp;\n' +
                                '                        <span >'+item.createtime+'</span>\n' +
                                '                    </div></div>';
                    })
                    $('.blogList').append(l);
                    pageNo += 1;
                }

            }
        });
    })
</script>
</html>
